package GateWars;

public class BaseParser {
	
	public static void parse(String s) {
		String[] elements = s.split("<TR>");
		/*for(int i = 0; i < elements.length; i++){
			System.out.print(i + ":\n" + elements[i]);
		}*/
		String[] temp;
		temp = elements[10].split("page=");
		temp = temp[1].split(" \"");
		GateWarsFactory.getGateWarsManager().page = new Integer(temp[0].trim().replace(",", ""));
		
		temp = elements[13].split("Turns: ");
		temp = temp[1].split("</b>");
		GateWarsFactory.getGateWarsManager().turns = new Short(temp[0].trim().replace(",", ""));
		
		temp = elements[14].split("Naquadah: ");
		temp = temp[1].split("</b>");
		GateWarsFactory.getGateWarsManager().naq = new Long(temp[0].trim().replace(",", ""));
		
		temp = elements[15].split(": ");
		temp = temp[3].split("</A>");
		GateWarsFactory.getGateWarsManager().bankNaq = new Long(temp[0].trim().replace(",", ""));
		
		temp = elements[16].split("Next Turn:");
		temp = temp[1].split(" min");
		GateWarsFactory.getGateWarsManager().nextTurn = new Byte(temp[0].trim());
		
		temp = elements[25].split("id=");
		temp = temp[1].split("\">");
		GateWarsFactory.getGateWarsManager().id = new Integer(temp[0].trim());
		GateWarsFactory.getGateWarsManager().name = temp[1].split("</a>")[0];
		/*
		temp = elements[27].split("selected >");
		temp = temp[1].split("</option>");
		GateWarsFactory.getGateWarsManager().perg = (temp[0].equals("Normal Reality"));
		
		temp = elements[39].split("/day ");
		temp = temp[1].split(" <b>");
		GateWarsFactory.getGateWarsManager().unitPord = new Integer(temp[0].substring(1).trim().replace(",", ""));
		
		temp = elements[42].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().covertCap = new Byte(temp[0].trim());
		
		temp = elements[54].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().stike = new Long(temp[0].trim().replace(",", ""));
		
		temp = elements[55].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().defence = new Long(temp[0].trim().replace(",", ""));
		
		temp = elements[56].split("white\">");
		temp = temp[2].split("</TR>");
		GateWarsFactory.getGateWarsManager().covert = new Long(temp[0].substring(0, temp[0].length() - 1).trim().replace(",", ""));
		
		temp = elements[57].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().antiCov = new Long(temp[0].trim().replace(",", ""));
		
		temp = elements[58].split("white\">");
		temp = temp[2].split(" </b>");
		GateWarsFactory.getGateWarsManager().MSAction = new Long(temp[0].trim().replace(",", ""));
		
		temp = elements[62].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().AttackDrone = new Integer(temp[0].trim().replace(",", ""));
		
		temp = elements[63].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().AttackClone = new Integer(temp[0].trim().replace(",", ""));
		
		temp = elements[64].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().AttackMercenaries = new Integer(temp[0].trim().replace(",", ""));
		
		temp = elements[65].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().DefenseDrone = new Integer(temp[0].trim().replace(",", ""));
		
		temp = elements[66].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().DefenseClone = new Integer(temp[0].trim().replace(",", ""));
		
		temp = elements[67].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().DefenseMercenaries = new Integer(temp[0].trim().replace(",", ""));
		
		temp = elements[68].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().GeneralDrone = new Integer(temp[0].trim().replace(",", ""));
		
		temp = elements[70].split("white\">");
		temp = temp[2].split(" ");
		GateWarsFactory.getGateWarsManager().MiningDrone = new Integer(temp[0].trim().replace(",", ""));
		GateWarsFactory.getGateWarsManager().lifers = new Integer(temp[1].substring(1, temp[1].length() - 1).trim().replace(",", ""));
		
		temp = elements[71].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().UndercoverAgents = new Integer(temp[0].trim().replace(",", ""));
		
		temp = elements[72].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().AntiIntelligenceDrone = new Integer(temp[0].trim().replace(",", ""));
		
		temp = elements[73].split("white\">");
		temp = temp[2].split("</font>");
		GateWarsFactory.getGateWarsManager().TotalFightingForce = new Integer(temp[0].trim().replace(",", ""));
		//System.out.println(proxy.game.TotalFightingForce);
		/*
          77:

		              <TD align=left>01000100010</TD>
            <TD align=left>+ 10,125 Unit Production</TD>
            <TD align=left>0(Def: 0)</TD>
            <TD align=left>monsterous</TD>
                   78:

		              <TD align=left>Snappy Name Here</TD>
            <TD align=left>+ 23,902 Unit Production</TD>
            <TD align=left>0(Def: 0)</TD>
            <TD align=left>monsterous</TD>
                   79:

		              <TD align=left>Magic Crayons</TD>
            <TD align=left>+ 11,346,300,000 Attack</TD>
            <TD align=left>0(Def: 0)</TD>
            <TD align=left>huge</TD>
                   80:

		              <TD align=left>Buying 60mil uu </TD>
            <TD align=left>+ 15,938 Unit Production</TD>
            <TD align=left>0(Def: 0)</TD>
            <TD align=left>huge</TD>
                   81:

		              <TD align=left>peace for peace</TD>
            <TD align=left>+ 9,597 Unit Production</TD>
            <TD align=left>0(Def: 0)</TD>
            <TD align=left>huge</TD>
                   82:

		              <TD align=left>Y oh Y oh Y</TD>
            <TD align=left>+ 22,073 Unit Production</TD>
            <TD align=left>399(Def: 1,197,000,000)</TD>
            <TD align=left>huge</TD>
                   83:

		              <TD align=left>close friend of oma desala</TD>
            <TD align=left>+ 15,375 Unit Production</TD>
            <TD align=left>0(Def: 0)</TD>
            <TD align=left>huge</TD>
                   84:

		              <TD align=left>Outpost 5</TD>
            <TD align=left>+ 7,547 Unit Production</TD>
            <TD align=left>0(Def: 0)</TD>
            <TD align=left>large</TD>
                   85:

		              <TD align=left>Im Farmer BoB</TD>
            <TD align=left>+ 2,616 Unit Production</TD>
            <TD align=left>1850(Def: 5,550,000,000)</TD>
            <TD align=left>above average</TD>
	    */
		
		//System.out.print(s);
	}

}
